package cn.iocoder.yudao.module.aiposter.dal.mysql.material;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.aiposter.dal.dataobject.material.MaterialDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.aiposter.controller.app.material.vo.*;

/**
 * 素材资源 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface AppMaterialMapper extends BaseMapperX<MaterialDO> {

    default PageResult<MaterialDO> selectPage(AppMaterialPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MaterialDO>()
                .likeIfPresent(MaterialDO::getName, reqVO.getName())
                .eqIfPresent(MaterialDO::getType, reqVO.getType())
                .eqIfPresent(MaterialDO::getValue, reqVO.getValue())
                .betweenIfPresent(MaterialDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(MaterialDO::getId));
    }

}